<template>
  <div class="home" style="padding-bottom:50px">
    <van-swipe :autoplay="3000">
      <van-swipe-item v-for="(image, index) in images" :key="index">
        <img v-lazy="image" height="180px"/>
      </van-swipe-item>
    </van-swipe>

    <div class="home_promotion">
      <img src="~images/icon/share.png" width="20px" height="20px">
      <div>推荐好友下载APP，好运齐分享~戳我看看</div>
    </div>
    <van-notice-bar
    color="#000"
    background="#fff"
    :left-icon="icon.notice"
    :speed=30
    >{{notice}}
    </van-notice-bar>
    <div class="buttonBox">
      <div class="imageBox"
      v-for="(item,index) in buttonList"
      :key="index"
      @click='gotoPage(item.route)'
      v-if="(index===0 && !$username) || (index===3 && $username) || !(index===0 || index===3)">
        <img :src="item.image" alt="" width="30px" height="24px" style="display:block">
        <p style="font-size:14px;margin-top:8px">{{item.title}}</p>
      </div>
    </div>
    <van-swipe :autoplay="3000" :show-indicators="indicators" style="padding-top:9px;height:95px">
      <van-swipe-item v-for="(type, index) in types" :key="index">
        <div class="scroll-li">
          <img :src="type.src" alt="" class="icon">
          <div class="desc">
            <p class="title">{{type.title}}</p>
            <p class="text" v-for="(textItem,index) in type.text" :key="index">{{textItem}}</p>
          </div>
          <div class="act">
            <van-count-down :time="type.time" class="time" />
            <div class="buy">购买</div>
          </div>
        </div>
      </van-swipe-item>
    </van-swipe>
    <!-- 活动 -->
    <div class="iZkpsS" v-show="true">
      <div class="gYlzRL">
        <img src="" alt="" class="before">
        <div class="center">活动1 / 共参与进行中1个活动</div>
        <img src="" alt="" class="next">
        <div class="more">更多&gt;&gt;</div>
      </div>
      <div class="dFDuQP">
        <div class="cSqTby">
          <div class="name">亿万红包雨
            <div class="date">活动期间：10/15至10/16</div>
          </div>
        </div>
        <div class="gLMjgo">
          <div class="radius">
            <div class="fFRdBp">
              <div class="RZjRh">
                <div class="fVetKB">
                  <div class="left">
                    <div class="desc">
                      充值至少100元(时间段总充值,1天)就能获得抽红包1个!
                    </div>
                    <div class="am-progress-outer" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="background-color: rgb(237, 237, 237); border-radius: 100px; overflow: hidden; width: 192px; height: 6px;">
                      <div class="am-progress-bar" style="border: 0px solid rgb(255, 201, 87); width: 0%; height: 0px;"></div>
                    </div>
                  </div>
                  <div class="right">
                    <div class="icon current">
                      <img src="https://api.dk38dj27.info/assets/activities/themes/theme1/app/activityredbag.png" alt="">
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- 彩种 -->
    <div class="home-categories">
      <div class="home-categories-block" v-for="(categorie,index) in categories" :key="index">
        <p class="home-categories-block-name">
          <span>{{categorie.type}}</span>
          <a href="" style="font-size:14px;color:#661dac">更多></a>
        </p>
        <div class="home-categories-item" v-for="(ticket,index) in categorie.tickets" :key="index">
          <img :src="ticket.src" alt="" class="home-categories-item-image">
          <p class="home-categories-item-name">{{ticket.title}}</p>
          <p class="home-categories-item-desc">{{ticket.content}}</p>
        </div>
      </div>
    </div>
    <tabbar />
  </div>
</template>
<script>
import Tabbar from 'components/Tabbar'
import Vue from 'vue'
export default {
  name: 'homePage',
  components: {
    Tabbar
  },
  data () {
    return {
      indicators: false,
      icon: {
        notice: require('../../assets/images/icon/notice.png')
      },
      images: [
        'https://api.dk38dj27.info/assets/api/pc-mobile/banner2.png',
        'https://api.dk38dj27.info/assets/api/pc-mobile/banner1.png',
        'https://api.dk38dj27.info/upload/2019-10/0_20191012015509.png',
        'https://api.dk38dj27.info/upload/2019-10/0_20191012015312.jpg'
      ],
      types: [
        {
          src: 'https://api.dk38dj27.info/assets/cgi/jsctpk10.png',
          title: '极速赛车',
          text: ['每周2、4、6开奖', '美20分钟开一期'],
          time: 30 * 60 * 60 * 1000
        },
        {
          src: 'https://api.dk38dj27.info/assets/cgi/xg6hc.png',
          title: '香港六合彩',
          text: ['每周2、4、6开奖'],
          time: 30 * 60 * 60 * 1000
        }
      ],
      notice: '金盛平台推出国庆充值送豪礼活动充值活动请关注--金盛彩票平台--首页--最新优惠活动！',
      buttonList: [
        { image: require('../../assets/images/icon/button_1.png'), title: '登录/注册', time: '', route: 'login' },
        { image: require('../../assets/images/icon/button_2.png'), title: '存款充值', route: 'investMoney' },
        { image: require('../../assets/images/icon/button_3.png'), title: '取款提款', route: 'fundPassword' },
        { image: require('../../assets/images/icon/moveCenter.png'), title: '活动中心', route: 'discount' },
        { image: require('../../assets/images/icon/button_4.png'), title: '优惠活动', route: 'discount' },
        { image: require('../../assets/images/icon/button_5.png'), title: '在线客服', route: 'login' }
      ],
      categories: [
        {
          tickets: [{
            src: require('../../assets/images/tickets/js1fk3.png'),
            title: '一分快3',
            content: '每1分钟开一期'
          }, {
            src: require('../../assets/images/tickets/jsgdk3.png'),
            title: '广东快3',
            content: '每6分钟开一期'
          }, {
            src: require('../../assets/images/tickets/jsxgk3.png'),
            title: '香港快3',
            content: '每8分钟开一期'
          }, {
            src: require('../../assets/images/tickets/jstwk3.png'),
            title: '台湾快3',
            content: '每12分钟开一期'
          }, {
            src: require('../../assets/images/tickets/jsk3.png'),
            title: '急速快3',
            content: '每3分钟开一期'
          }, {
            src: require('../../assets/images/tickets/jsxyk3.png'),
            title: '幸运快3',
            content: '每5分钟开一期'
          } ],
          type: '传统彩'
        },
        {
          tickets: [],
          type: '低频彩'
        }
      ]

    }
  },
  methods: {
    gotoPage (route) {
      this.$router.push({ name: route })
    }
  },
  mounted () {
    console.log(123)
  }
}
</script>
<style lang="less" scoped>
/deep/.van-swipe-item img {
  width: 100%;
}
.home{
  .home_promotion{
    height:40px;
    padding:0 20px;
    display: flex;
    align-items:center;
    border-bottom:1px solid #d3d3d3;
    background-color: #fff;
    img{
      display:inline-block;
      margin-right: 10px;
    }
    div{
      display:inline-block;
      font-size:14px;
    }
  }
  .van-notice-bar__content{
    font-size: 14px;
  }
  .scroll-li{
    height:78px;
    width:310px;
    display: flex;
    padding:12px;
    background:#fff;
    border-radius: 5px;
    box-shadow: 5px 5px 20px #ddd;
    align-items:center;
    .icon{
      width: 56px;
      height: 56px;
      margin-right: 8px;
    }
    .desc{
      width: 150px;
      overflow: hidden;
      .title{
        font-size: 15px;
        font-weight: 700;
        color: #3f3f3f;
        line-height: 25px;
        white-space: nowrap;
      }
      .text{
        font-size: 12px;
        color: #989898;
        line-height: 14px;
        white-space: nowrap;
      }
    }
    .act{
      display: flex;
      -ms-flex-direction: column;
      flex-direction: column;
      -ms-flex-align: center;
      align-items: center;
      -ms-flex-pack: center;
      justify-content: center;
      .time{
        font-size: 18px;
        color: #3f3f3f;
        white-space: nowrap;
      }
      .buy{
        margin-top: 8px;
        white-space: nowrap;
        font-size: 12px;
        width: 48px;
        height: 22px;
        line-height: 22px;
        color: #f70;
        border: 1px solid #f70;
        border-radius: 107px;
        text-align: center;
      }
    }
  }
  .iZkpsS{
    height: auto;
    box-sizing: border-box;
    color: rgb(155, 155, 155);
    margin: 0px 12px 12px;
    border-radius: 5px;
    overflow: hidden;
  }
  .gYlzRL{
    display: flex;
    height: 40px;
    position: relative;
    -webkit-box-pack: center;
    justify-content: center;
    -webkit-box-align: center;
    align-items: center;
    .center{
      font-size: 12px;
      color: rgb(51, 51, 51);
    }
    .more{
      height: 100%;
      position: absolute;
      right: 0px;
      top: 0px;
      display: flex;
      -webkit-box-pack: center;
      justify-content: center;
      -webkit-box-align: center;
      align-items: center;
      font-size:12px;
    }
  }
  .gYlzRL .before, .gYlzRL .next {
    width: 20px;
    padding: 8px;
}
.dFDuQP {
    box-sizing: border-box;
    box-shadow: rgba(194, 194, 194, 0.7) 0px 1px 5px;
    position: relative;
    background-color: rgb(255, 255, 255);
    overflow: hidden;
}
.cSqTby {
    height: 45px;
    background-image: url(https://api.dk38dj27.info/assets/activities/themes/theme1/app/header.png);
    background-size: cover;
    display: flex;
    flex-direction: column;
    -webkit-box-pack: center;
    justify-content: center;
    -webkit-box-align: center;
    align-items: center;
    color: rgb(255, 255, 255);
    position: relative;
    background-repeat: no-repeat;
}
.cSqTby .name {
    width: 100%;
    box-sizing: border-box;
    font-size: 16px;
    text-align: center;
    white-space: nowrap;
    text-overflow: ellipsis;
    padding: 0px 10px;
    overflow: hidden;
}
.cSqTby .date {
    margin-top: 6px;
    font-size:12px;
}
.cSqTby .final {
    display: none;
    position: absolute;
    top: -1px;
    right: -1px;
    height: 100%;
}
.gLMjgo {
    background-color: rgb(80, 14, 145);
    padding: 0px 10px 10px;
    border-bottom-right-radius: 6px;
    border-bottom-left-radius: 6px;
}
.gLMjgo .radius {
    border-radius: 4px;
    overflow: hidden;
}
.fFRdBp {
    box-sizing: border-box;
    color: rgb(155, 155, 155);
    overflow: hidden;
}
.RZjRh {
    box-sizing: border-box;
    box-shadow: rgba(194, 194, 194, 0.7) 0px 1px 5px;
    position: relative;
    overflow: hidden;
}
.fVetKB {
    box-sizing: border-box;
    height: 130px;
    background-color: rgb(255, 255, 255);
    display: flex;
    -webkit-box-pack: center;
    justify-content: center;
    -webkit-box-align: center;
    align-items: center;
    padding: 4px;
}
.fVetKB .left {
    overflow: hidden;
}
.fVetKB .left .desc {
    width: 192px;
    color: rgb(197, 0, 0);
    text-align: left;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin: 0px auto 8px;
    overflow: hidden;
    font-size:12px;
}
.fVetKB .right {
    margin-left: 20px;
    position: relative;
}
.fVetKB .right .icon.current {
    position: relative;
}
.fVetKB .right .icon {
    width: 72px;
    height: 72px;
}
.fVetKB .right .icon img {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
}
.fVetKB .right .icon.current::after {
    content: "";
    position: absolute;
    z-index: 0;
    background-color: rgb(244, 58, 81);
    border-radius: 50%;
    animation: 1s ease 0s infinite normal none running missionBorder;
}
.home-categories{
      background-color: #f5f5f9;
}
.home-categories-block {
    margin: 8px 0;
    padding: 10px;
    background: #fff;
}
.home-categories-block-name {
    font-size: 16px;
    margin: 8px 0 8px 4px;
    padding-left: 4px;
    border-left: 6px solid #661dac;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-pack: justify;
    justify-content: space-between;
    -ms-flex-align: center;
    align-items: center;
}
.home-categories-item {
    position: relative;
    display: inline-block;
    vertical-align: top;
    width: 50%;
    padding: 15px 4px;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
}
.home-categories-item-image {
    width: 52px;
    height: 52px;
    float: left;
    margin-right: 4px;
}
.home-categories-item-name {
    margin-top: 11px;
    margin-bottom: 4px;
    font-size: 14px;
    font-weight: 700;
}
.home-categories-item-desc {
    color: #999;
}
.buttonBox{
  height:75px;
  background-color:#fff;
  flex-direction:row;
  display:flex;
}
.imageBox{
  width:20%;
  height:75px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:center
}
}
</style>
